﻿Imports DevComponents.DotNetBar

Public Class FrmMain

    Private Sub mtProductos_Click(sender As Object, e As EventArgs) Handles mtProdcuctos.Click
        FrmCatalogo.Show()
    End Sub

    Private Sub tileUsuario_Click(sender As Object, e As EventArgs)
        'Line1.BackColor = System.Drawing.Color.FromArgb(64, 64, 64)
        ' Line2.BackColor = System.Drawing.Color.FromArgb(64, 64, 64)
        ' Line1.ForeColor = Color.Gray
        ' Line2.ForeColor = Color.Gray
        'slideUsuario.BackColor = System.Drawing.Color.FromArgb(64, 64, 64)
        'slideUsuario.IsOpen = Not slideUsuario.IsOpen
    End Sub

    Private Sub FrmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try

            'TODO: esta línea de código carga datos en la tabla 'ERP_BDDataSet.Tareas_Pendientes' Puede moverla o quitarla según sea necesario.
            Me.Tareas_PendientesTableAdapter.Fill(Me.ERP_BDDataSet.Tareas_Pendientes)
            ' slideUsuario.IsOpen = False
            slideTareas.IsOpen = False

            'Line1.BackColor = System.Drawing.Color.FromArgb(64, 64, 64)
            ' Line2.BackColor = System.Drawing.Color.FromArgb(64, 64, 64)
            'Line1.ForeColor = Color.Gray
            ' Line2.ForeColor = Color.Gray

            pageInicial.BackColor = System.Drawing.Color.FromKnownColor(KnownColor.DodgerBlue)
            pageMenu.BackColor = System.Drawing.Color.FromKnownColor(KnownColor.Control)
            tilePanelMenu.BackColor = System.Drawing.Color.FromKnownColor(KnownColor.Control)
            lblEmpresa.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
            lblTitulo.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
            lblUsuario.ForeColor = System.Drawing.Color.FromArgb(64, 64, 64)
            cpPreparando.BackColor = Color.Transparent
            'slideUsuario.BackColor = System.Drawing.Color.FromArgb(64, 64, 64)
            cpPreparando.Visible = True
            cpPreparando.IsRunning = True

            Timer1.Enabled = True
        Catch ex As Exception
            ToastNotification.Show(Me, ex.Message, My.Resources.appbar_cone, 5000, eToastGlowColor.Red, eToastPosition.MiddleCenter)
        End Try
    End Sub

    Private Sub btnSalir_Click(sender As Object, e As EventArgs)
        Me.Close()
    End Sub

    Public Sub Notificacion_tareas()
        dgvTareas.Rows.Clear()
        Me.Tareas_PendientesTableAdapter.Fill(Me.ERP_BDDataSet.Tareas_Pendientes)
        If tareas_erp.Numero_Tareas(_IDUSUARIO) > 0 Then
            ToastNotification.Show(Me,
                                   "Usted tiene: " & tareas_erp.Numero_Tareas(_IDUSUARIO) & " tarea(s) pendientes", My.Resources.MB_0013_APP_info1, 3000, eToastGlowColor.Green, eToastPosition.BottomCenter)
            Sonido_notificacion()
            mtTareas.TitleText = "TAREAS (" & tareas_erp.Numero_Tareas(_IDUSUARIO) & ")"
            Dim i As Integer = 0
            For Each fila As DataRow In Me.ERP_BDDataSet.Tareas_Pendientes
                dgvTareas.Rows.Add()
                dgvTareas.Rows(i).Cells(0).Value = Me.ERP_BDDataSet.Tareas_Pendientes.Item(i).TIPO & " se dejo en pendiente"
                i += 1
            Next
        End If
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If psPrincipal.SelectedPageIndex = 0 Then
            cpPreparando.Update()
            Timer1.Enabled = False
            psPrincipal.SelectedPage = pageMenu
            Notificacion_tareas()
        End If
    End Sub

    Private Sub mtTareas_Click(sender As Object, e As EventArgs) Handles mtTareas.Click
        slideTareas.IsOpen = Not slideTareas.IsOpen
    End Sub

    Private Sub dgvTareas_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvTareas.CellContentClick
        _IDTAREA = Me.ERP_BDDataSet.Tareas_Pendientes.Item(e.RowIndex).IDTAREA
        If Me.ERP_BDDataSet.Tareas_Pendientes.Item(e.RowIndex).TIPO = "Producto" Or Me.ERP_BDDataSet.Tareas_Pendientes.Item(e.RowIndex).TIPO = "Servicio" Then
            _IDPRODUCTO = Me.ERP_BDDataSet.Tareas_Pendientes.Item(e.RowIndex).IDREGISTRO
            _Editar = False
            _EnTarea = True
            If Me.ERP_BDDataSet.Tareas_Pendientes.Item(e.RowIndex).TIPO = "Producto" Then
                FrmCapturaProducto.Show()
            Else
                FrmCapturaServicio.Show()
            End If
        End If
    End Sub

    Private Sub mtAutobuses_Click(sender As Object, e As EventArgs) Handles mtAutobuses.Click
        FrmCatalogoAutobuses.Show()
    End Sub

    Private Sub mtCompras_Click(sender As Object, e As EventArgs) Handles mtCompras.Click
        FrmCatalogoCompras.Show()
    End Sub

    Private Sub mtProveedores_Click(sender As Object, e As EventArgs) Handles mtProveedores.Click
        FrmProveedores.Show()
    End Sub

    Private Sub mtExistencias(sender As Object, e As EventArgs) Handles MetroTileItem7.Click

        PedidosAutomaticos.ConsultarExistencias(3)
        frmExistencias.Show()

    End Sub

    Private Sub Pedidos_Click(sender As Object, e As EventArgs) Handles Pedidos.Click
        frmPedidos.Show()
    End Sub

    Private Sub mtPersonal_Click(sender As Object, e As EventArgs) Handles mtPersonal.Click
        frmPersonal.Show()
    End Sub

    Private Sub mtOrdenCompra_Click(sender As Object, e As EventArgs) Handles mtOrdenCompra.Click
        FrmCatalogoOrdenCompra.Show()
    End Sub

    Private Sub ButtonItem19_Click(sender As Object, e As EventArgs) Handles btnUser.Click
        'Line1.BackColor = System.Drawing.Color.FromArgb(64, 64, 64)
        'Line2.BackColor = System.Drawing.Color.FromArgb(64, 64, 64)
        ' Line1.ForeColor = Color.Gray
        ' Line2.ForeColor = Color.Gray
        '  slideUsuario.BackColor = System.Drawing.Color.FromArgb(64, 64, 64)
        ' slideUsuario.IsOpen = Not slideUsuario.IsOpen
    End Sub

    Private Sub ButtonItem4_Click(sender As Object, e As EventArgs) Handles ButtonItem4.Click
        Me.Close()
    End Sub

    Private Sub MetroTileItem18_Click(sender As Object, e As EventArgs) Handles MetroTileItem18.Click
        FrmGrabadoDeTag.Show()

    End Sub

    Private Sub ButtonItem5_Click(sender As Object, e As EventArgs) Handles ButtonItem5.Click
        frmLoggin.Show()
        Me.Close()
    End Sub

    Private Sub MetroTileItem20_Click(sender As Object, e As EventArgs) Handles MetroTileItem20.Click
        System.Diagnostics.Process.Start("RFIDSuprema.exe")
    End Sub

    Private Sub mtAlmacenes_Click(sender As Object, e As EventArgs) Handles mtAlmacenes.Click
        FrmCapturaAlmacen.Show()
    End Sub

    Private Sub tilePanelMenu_ItemClick(sender As Object, e As EventArgs) Handles tilePanelMenu.ItemClick

    End Sub
End Class